package com.filemanager;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.BufferedReader;

/**
 * Created by IntelliJ IDEA.
 * User: Anna.Bulenkova
 * Date: 26.10.11
 * Time: 15:27
 */
public class Utils {
    public static MyJAXBObject getObjectFromXML (BufferedReader in) throws JAXBException {
        MyJAXBObject object = new MyJAXBObject();
        JAXBContext jc = JAXBContext.newInstance(object.getClass());
        Unmarshaller u = jc.createUnmarshaller();
        object = (MyJAXBObject) u.unmarshal(in);
        return object;
    }

    public static void main(String[] args) throws JAXBException {
//        MyJAXBObject object = new MyJAXBObject();
//        JAXBContext jc = JAXBContext.newInstance(object.getClass());
//        Unmarshaller u = jc.createUnmarshaller();
//        File file = new File("jaxbobject.xml");
//        object = (MyJAXBObject) u.unmarshal(file);
//        System.out.println(object);

    }

}
